<template>
	<!-- 意见反馈 -->
	<view class="container">
    <view class="content">
      <textarea class="textarea" v-model="optionValue" auto-height placeholder="我们想听听你的心声，如果愿意，你也可以留下联系方式，我们期待与你的真诚沟通。" />
    </view>
    <view class="btn" @tap="addOpinion">确认</view>
	</view>
</template>

<script>
	import {
		postOptionData
	} from '../../api/api.js'
	export default {
		data() {
			return {
				optionValue: ''
			}
		},
		
		methods: {
			addOpinion() {
				let data = {
					content: this.optionValue,
				}
				postOptionData(data).then(res => {
					uni.showToast({
            title: '提交成功',
            icon: 'none'
          });
					setTimeout(() => {
						uni.navigateBack({
							delta: 1,
						})
					}, 1000)
				}).catch(err => {
					console.log(err);
				});
			}
		}
	}
</script>

<style scoped lang="scss">
.btn {
  width: calc(100% - 40rpx);
  margin: 40rpx auto 0;
  padding: 20rpx 0;
  text-align: center;
  background: #DF4B43;
  border-radius: 55rpx;
  font-size: 32rpx;
  color: #FFFFFF;
}
.textarea {
  min-height: 300rpx;
  width: calc(100% - 80rpx);
  border: 1px solid #ccc;
  padding: 20rpx;
  margin: 40rpx auto 0;
}
</style>
